<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button>按钮</button>

  <script>
    /**
     * 节流策略
     *  ● 处理事件后，一段时间内不再处理新的事件
     */
    const throttle = 1000
    let timeoutID
    document.querySelector('button').addEventListener('click', event => {
      if (timeoutID) return

      // TODO
      console.log('Do something')

      timeoutID = setTimeout(() => {
        timeoutID = undefined
      }, throttle)
    })
  </script>
</body>

</html>